Socket
Socket
Sign inDemoInstall

@types/wrap-ansi

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/wrap-ansi

TypeScript definitions for wrap-ansi


Version published
Weekly downloads
3.5M
increased by0.83%
Maintainers
1
Weekly downloads
 
Created

What is @types/wrap-ansi?

@types/wrap-ansi provides TypeScript type definitions for the wrap-ansi package, which is used to wrap words to a specified width while preserving ANSI escape codes.

What are @types/wrap-ansi's main functionalities?

Wrap text to a specified width

This feature allows you to wrap a string of text to a specified width. In this example, the input string is wrapped to a width of 20 characters.

const wrapAnsi = require('wrap-ansi');
const input = 'The quick brown fox jumps over the lazy dog';
const output = wrapAnsi(input, 20);
console.log(output);

Preserve ANSI escape codes

This feature ensures that ANSI escape codes are preserved when wrapping text. In this example, the input string contains ANSI escape codes for red text, and these codes are preserved in the output.

const wrapAnsi = require('wrap-ansi');
const input = '\u001B[31mThe quick brown fox jumps over the lazy dog\u001B[39m';
const output = wrapAnsi(input, 20);
console.log(output);

Hard wrapping

This feature allows for hard wrapping, which means that words will be split if they exceed the specified width. In this example, the input string is hard-wrapped to a width of 20 characters.

const wrapAnsi = require('wrap-ansi');
const input = 'The quick brown fox jumps over the lazy dog';
const output = wrapAnsi(input, 20, { hard: true });
console.log(output);

Other packages similar to @types/wrap-ansi

FAQs

Package last updated on 23 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc